USE [db.jyd.com]
GO

/****** Object:  Table [dbo].[AuthorityInfo]    Script Date: 08/04/2013 20:12:47 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[AuthorityInfo](
	[AuthId] [bigint] IDENTITY(1,1) NOT NULL,
	[Code] [varchar](50) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Remark] [nvarchar](200) NULL,
	[Status] [int] NULL,
	[Type] [int] NULL,
	[CreateTime] [datetime] NOT NULL,
	[UpdateTime] [datetime] NOT NULL,
	[OpId] [bigint] NULL,
 CONSTRAINT [PK_AuthorityInfo] PRIMARY KEY CLUSTERED 
(
	[AuthId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[AuthorityInfo] ADD  CONSTRAINT [DF_AuthorityInfo_CreateTime]  DEFAULT (getdate()) FOR [CreateTime]
GO

ALTER TABLE [dbo].[AuthorityInfo] ADD  CONSTRAINT [DF_AuthorityInfo_UpdateTime]  DEFAULT (getdate()) FOR [UpdateTime]
GO




USE [db.jyd.com]
GO

/****** Object:  Table [dbo].[MenuInfo]    Script Date: 08/04/2013 20:14:38 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[MenuInfo](
	[MenuId] [varchar](20) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Url] [varchar](100) NULL,
	[Level] [int] NULL,
	[Sort] [int] NULL,
	[Status] [int] NULL,
	[Type] [int] NULL,
	[CreateTime] [datetime] NOT NULL,
	[UpdateTime] [datetime] NOT NULL,
	[OpId] [bigint] NULL,
 CONSTRAINT [PK_MenuInfo] PRIMARY KEY CLUSTERED 
(
	[MenuId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[MenuInfo] ADD  CONSTRAINT [DF_MenuInfo_CreateTime]  DEFAULT (getdate()) FOR [CreateTime]
GO

ALTER TABLE [dbo].[MenuInfo] ADD  CONSTRAINT [DF_MenuInfo_UpdateTime]  DEFAULT (getdate()) FOR [UpdateTime]
GO

USE [db.jyd.com]
GO

/****** Object:  Table [dbo].[MenuAuthInfo]    Script Date: 08/04/2013 20:14:59 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[MenuAuthInfo](
	[MenuId] [varchar](20) NOT NULL,
	[AuthId] [bigint] NOT NULL,
	[Status] [int] NULL,
	[Type] [int] NULL,
	[CreateTime] [datetime] NOT NULL,
	[UpdateTime] [datetime] NOT NULL,
	[OpId] [bigint] NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[MenuAuthInfo]  WITH CHECK ADD  CONSTRAINT [FK_MenuAuthInfo_AuthorityInfo] FOREIGN KEY([AuthId])
REFERENCES [dbo].[AuthorityInfo] ([AuthId])
GO

ALTER TABLE [dbo].[MenuAuthInfo] CHECK CONSTRAINT [FK_MenuAuthInfo_AuthorityInfo]
GO

ALTER TABLE [dbo].[MenuAuthInfo]  WITH CHECK ADD  CONSTRAINT [FK_MenuAuthInfo_MenuInfo] FOREIGN KEY([MenuId])
REFERENCES [dbo].[MenuInfo] ([MenuId])
GO

ALTER TABLE [dbo].[MenuAuthInfo] CHECK CONSTRAINT [FK_MenuAuthInfo_MenuInfo]
GO

ALTER TABLE [dbo].[MenuAuthInfo] ADD  CONSTRAINT [DF_MenuAuthInfo_CreateTime]  DEFAULT (getdate()) FOR [CreateTime]
GO

ALTER TABLE [dbo].[MenuAuthInfo] ADD  CONSTRAINT [DF_MenuAuthInfo_UpdateTime]  DEFAULT (getdate()) FOR [UpdateTime]
GO


USE [db.jyd.com]
GO

/****** Object:  Table [dbo].[RoleAuthInfo]    Script Date: 08/04/2013 20:15:13 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[RoleAuthInfo](
	[RoleId] [bigint] NOT NULL,
	[AuthId] [bigint] NOT NULL,
	[Status] [int] NULL,
	[Type] [int] NULL,
	[CreateTime] [datetime] NOT NULL,
	[UpdateTime] [datetime] NOT NULL,
	[OpId] [bigint] NULL
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[RoleAuthInfo]  WITH CHECK ADD  CONSTRAINT [FK_RoleAuthInfo_AuthorityInfo] FOREIGN KEY([AuthId])
REFERENCES [dbo].[AuthorityInfo] ([AuthId])
GO

ALTER TABLE [dbo].[RoleAuthInfo] CHECK CONSTRAINT [FK_RoleAuthInfo_AuthorityInfo]
GO

ALTER TABLE [dbo].[RoleAuthInfo]  WITH CHECK ADD  CONSTRAINT [FK_RoleAuthInfo_RoleInfo] FOREIGN KEY([RoleId])
REFERENCES [dbo].[RoleInfo] ([RoleId])
GO

ALTER TABLE [dbo].[RoleAuthInfo] CHECK CONSTRAINT [FK_RoleAuthInfo_RoleInfo]
GO

ALTER TABLE [dbo].[RoleAuthInfo] ADD  CONSTRAINT [DF_RoleAuthInfo_CreateTime]  DEFAULT (getdate()) FOR [CreateTime]
GO

ALTER TABLE [dbo].[RoleAuthInfo] ADD  CONSTRAINT [DF_RoleAuthInfo_UpdateTime]  DEFAULT (getdate()) FOR [UpdateTime]
GO





